package com.zhiyou.app.shop.website.util;

import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.SimpleEmail;

public class MailTest {
	public static void main(String[] args) {
		SimpleEmail email = new SimpleEmail();
		email.setHostName("smtp.163.com");
		email.setAuthentication("sanaly", "shi0201shan");
		email.setCharset("UTF-8");
		try {
			email.addTo("919342127@qq.com");
			email.setFrom("sanaly@yeah.net");//必须和Authentication使用的用户相同，否则失败
			email.setSubject("haha");
			email.setMsg("---------------------测试");
			email.send();
		} catch (EmailException e) {
			e.printStackTrace();
		}
	}
}
